package xy.come.juhenews.Activity;

import android.content.Intent;
import android.graphics.Color;
import android.widget.Toast;

import java.util.ArrayList;

import xy.come.guidelibrary.PaperBoardingEngine;
import xy.come.guidelibrary.PaperOnBoardingPage;
import xy.come.guidelibrary.listeners.PaperOnBoardingOnChangeListener;
import xy.come.guidelibrary.listeners.PaperOnBoardingOnRightOutListener;
import xy.come.juhenews.Base.BaseActivity;
import xy.come.juhenews.MainActivity;
import xy.come.juhenews.R;

/**
 * Created by Xia_焱 on 2018/7/11.
 * e-mail：XiahaotianV@163.com
 */

public class GuideActivity extends BaseActivity {
    @Override
    public int getLayoutId() {
        return R.layout.activity_guide;
    }

    @Override
    protected void initView() {
        PaperBoardingEngine engine = new PaperBoardingEngine(findViewById(R.id.ll_root_view), getDataForOnBoarding(), getApplicationContext());

        engine.setOnChangeListener(new PaperOnBoardingOnChangeListener() {
            @Override
            public void onPageChanged(int oldElementIndex, int newElementIndex) {

            }
        });

        engine.setOnRightOutListener(new PaperOnBoardingOnRightOutListener() {
            @Override
            public void onRightOut() {
                Intent intent = new Intent(GuideActivity.this, MainActivity.class);
                startActivity(intent);
                finish();
            }
        });
    }


    @Override
    protected void initData() {

    }

    private ArrayList<PaperOnBoardingPage> getDataForOnBoarding() {

        PaperOnBoardingPage scr1 = new PaperOnBoardingPage("头条", "你最关心的，才是头条！",
                Color.parseColor("#678FB4"), R.drawable.icon_top, R.drawable.key);
        PaperOnBoardingPage scr2 = new PaperOnBoardingPage("体育", "综合体育,呈现排球、乒乓、羽毛球、田径、游泳、体操等项目海量赛事资讯、搜罗各类赛事的动态",
                Color.parseColor("#65B0B4"), R.drawable.icon_run, R.drawable.wallet);
        PaperOnBoardingPage scr3 = new PaperOnBoardingPage("科技", "科技新闻中心是科技讯重要频道,24小时滚动报道最新科技新闻,关注IT业界、电信、互联网以及电子商务领域是最及时权威的产业高端媒体",
                Color.parseColor("#5695F5"), R.drawable.icon_kj, R.drawable.shopping_cart);

        ArrayList<PaperOnBoardingPage> elements = new ArrayList<>();
        elements.add(scr1);
        elements.add(scr2);
        elements.add(scr3);
        return elements;
    }
}
